1.import java.util.Scanner;

public class sb {
    static int a,b;static double area;
    public static void main(String[] args) {
        Scanner in=new Scanner(System.in);
        System.out.println("请输入三角形的底");
        a=in.nextInt();
        System.out.println("请输入三角形的高");
        b=in.nextInt();
         a();
        System.out.println("三角形的面积="+area);
    }
    public static void a(){
        area=a*b*0.5;
    }

}
2.import java.util.Scanner;

public class sb {
    static int a,b;static double area;
    public static void main(String[] args) {
        Scanner in=new Scanner(System.in);
        System.out.println("请输入长方形的长");
        a=in.nextInt();
        System.out.println("请输入长方形的宽");
        b=in.nextInt();
         a();
        System.out.println("长方形的面积="+area);
    }
    public static void a(){
        area=a*b;
    }

}
3.import java.util.Scanner;

public class sb {
    static int a;static double area;
    public static void main(String[] args) {
        Scanner in=new Scanner(System.in);
        System.out.println("请输入正方形的边长");
        a=in.nextInt();
         a();
        System.out.println("正方形的面积="+area);
    }
    public static void a(){
        area=a*a;
    }

}